﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 简单的屏保
{
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Label1_Click(object sender, EventArgs e) {


        }
        int moveX = 10;
        int moveY = 10;
        private void Timer1_Tick(object sender, EventArgs e) {
            this.label1.Text = DateTime.Now.ToString();
            this.label1.Left += moveX;
            this.label1.Top += moveY;

            if (label1.Left < 1 || label1.Right < 1) {
                moveX = -moveX;
            }
            if (label1.Top < 1 || label1.Bottom < 1) {
                moveY = -moveY;
            }

        }

        private void Form1_KeyDown(object sender, KeyEventArgs e) {
            Return();
        }

        private void Form1_MouseClick(object sender, MouseEventArgs e) {
            Return();
        }

        private void Return() {
            //Application.Exit();

            this.Close();
        }

        private void Form1_Load(object sender, EventArgs e) {

        }
    }
}
